<template>
	<view class="page-container">
		<uni-nav-bar 
			dark 
			:fixed="true" 
			status-bar 
			left-icon="left" 
			:border="false" 
			title="新航向教育" 
			@clickLeft="back" 
		/>
		<view class="work">
			<view class="title">
			  <view>{{detail.title}}</view>
			</view>
			<view class="condition">
			  <view class="iconfont icon-weizhi">
			    <text>{{formatData(detail.createTime )}}</text>
			  </view>
			</view>
		</view>
		  <view class="detail">
		    <view class="detail-title">推广信息内容</view>
		    <view class="text-desc">
				<view>{{detail.content}}</view>
		    </view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {},
			}
		},
		onLoad(options) {
			const {id} = options;
			this.getDetailData(id);
		},
		methods: {
			// 获取推荐列表
			getDetailData(id) {
				this.$api.promotionDetail(id).then(res=>{
					if(res.code === 200) {
						this.detail = res.data;
					}
				})
			},
			back() {
				uni.navigateBack()
			},
			// 时间戳转换
			formatData(value) {
				var date = new Date(value);	
				//date.setTime(value);
				var month = date.getMonth() + 1;
				var day = date.getDate();
				if (month < 10) month = "0" + month;
				var minutes = date.getMinutes();
				if (day < 10) day = "0" + day;
				// var time = date.getFullYear() + "-" + month + "-" + date.getDate() +" " + hours + ":" + minutes;
				var time = date.getFullYear() + "-" + month + "-" + day;
				return time;
			}
		}
	}
</script>

<style lang="scss">
	page {
	  width: 680rpx;
	  // 84
	  // padding: 0 35rpx 180rpx;
	  padding-bottom: 180rpx;
	}
	.work {
		width: 680rpx;
		margin: auto;
		background: #fff;
		margin-top: 10rpx;
		padding-bottom: 30rpx;
		position: relative;
		&::after{
			position: absolute;
			box-sizing: border-box;
			content: ' ';
			pointer-events: none;
			right: 0;
			bottom: 0;
			left: 0;
			border-bottom: 1px solid #ebedf0;
			-webkit-transform: scaleY(.5);
			transform: scaleY(.5);
		}
		.title {
		  width: 680rpx;
		  padding: 20rpx 0 0;
		  display: flex;
		  justify-content: space-between;
		  align-content: center;
		  font-weight: 600;
		
			view {
				font-size: 40rpx;
				line-height: 50rpx;
			}
		
			text {
				font-size: 30rpx;
				color: $uni-color-primary;
				display: flex;
				align-items: center;
			}
		}
		
		.condition {
		  display: flex;
		  flex-wrap: wrap;
		  margin-top: 30rpx;
			.iconfont {
				display: flex;
				margin-right: 40rpx;
				color: #000;
			
				text {
				  margin-left: 10rpx;
				  font-size: 32rpx;
				}
			}
		}
	}
	.detail {
		width: 680rpx;
		padding: 0 0;
		margin-top: 30rpx;
		.detail-title {
			font-size: 38rpx;
			font-weight: 600;
		}
		.text-desc {
			font-size: 32rpx;
			color: #000;
			margin-top: 30rpx;
		}
	}
</style>
